#ifndef FACE_H
#define FACE_H

#include "color.h"
#include "object.h"
#include "edge.h"
#include "point.h"
#include "vertex.h"

class Face{
    public:
        Face(int = 0, Object * = NULL, bool = false);
//        Face(int, Vertex *, Vertex *, Vertex *);//contrutor para criar uma face de testes
        Face(int, Object *, Edge *, bool, bool = false);
        Face(int, Object *, Edge *, bool, Color, bool = false);
        ~Face();

        int getID() const;

        void select(bool);
        bool isSelected();

        void setIsBoundary(bool);
        bool isBoundary();

        void setColor(Color);
        Color getColor();

        void setObject(Object *);
        Object *getObject();

        void setEdge(Edge *, bool);
        Edge *getEdge();
        bool getEdgeSignal();

        void addVertexInThePlan(Vertex *);
        void setVerticesInThePlan(std::vector<Vertex *>);
        std::vector<Vertex *> getVerticesInThePlan();
        Vertex *getVertexInThePlan(int);
        unsigned int getVerticesInThePlanSize();

        void print();

        Point normal();
        void calculateNormal();
        void calculateNormalByVertices();

    private:
        int id;
        bool selected;
        bool inBoundary;
        bool normalCalculated;
        Point normalVector;
        Color color;
        std::vector<Vertex *> verticesInThePlan;

        Object *object;
        Edge *edge;
        bool edgeSignal; //1 - normal | 0 - inverse
};

bool haveIntersection(Point, Point, Point, Point, Point, Point);
bool testSignal(double, double, double);

#endif
